package com.ydl.shopping.annotation;

import com.fasterxml.jackson.annotation.JacksonAnnotationsInside;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.ydl.shopping.core.enums.DataMaskType;
import com.ydl.shopping.serializer.DataMaskSerializer;

import java.lang.annotation.*;

/**
 * 数据脱敏
 */
@Documented
@Target(ElementType.FIELD)
@Retention(RetentionPolicy.RUNTIME)
@JacksonAnnotationsInside
@JsonSerialize(using = DataMaskSerializer.class)
public @interface DataMask {
    DataMaskType type() default DataMaskType.DEFAULT;

    /**
     * 脱敏起始位置
     */
    int startInclude() default 0;

    /**
     * 脱敏结束位置
     */
    int endExclude() default 0;
}
